// store/home
export default {
    actions: {
        // context 上下文对象，可以理解为store
        sum_actions(context, num) {
            setTimeout(() => {
                context.commit('sum', num)  // 通过context去触发mutions中的sum
            }, 1000)
        }
    },
    mutations: {
        // 传入 state
        increment(state) {
            state.count++
        },
        sum(state, num) {
            // console.log(num);
            state.count += num.value
        }
    },
    state: {
        num: 0,
        str: '这是state数据',
        count: 0
    },
    getters: {
        getterCount(state, getters) {
            // console.log(state);
            return state.count + "我是getters"
        }
    }
}